using System;
using Be.Timvw.Framework.Collections.Generic;
using Be.Timvw.Framework.Namespace2;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework
{
    [TestClass]
    public class WhenSortingTypes
    {
        [TestMethod]
        public void ShouldSortAlphabetically()
        {
            Type[] typesToSort = new Type[]
                {
                typeof(int),
                typeof(Dummy2),
                typeof(Dummy1),
                typeof(Namespace1.Dummy1),
                typeof(Namespace1.Dummy2),
                typeof(double)
                };

            Type[] expected = new Type[]
                {
                typeof(Namespace1.Dummy1),
                typeof(Namespace1.Dummy2),
                typeof(Dummy1),
                typeof(Dummy2),
                typeof(double),
                typeof(int)
                };

            Type[] actual = TypeHelper.Sort(typesToSort);
            Assert.IsTrue(EnumerableHelper.HaveSameElements(expected, actual));
        }
    }
}